<?php

if(isset($_FILES['avatar']) && $_FILES['avatar']['error']==0) {
	echo "<pre>";
	print_r($_FILES);

	//$fileName = date('YmdHis').'_'.$_FILES['avatar']['name'];
	$fileName = date('YmdHis').'_'.rand().'_'.$_FILES['avatar']['name'];
	//$fileName = time().'_'.$_FILES['avatar']['name'];
	$src = $_FILES['avatar']['tmp_name'];
	$dest = "uploads/$fileName";
	///move_uploaded_file($src,$dest);
	$flag = copy($src,$dest);
	var_dump($flag);
	if($flag==true){
		echo "File Uploaded successfully";
	} else {
		echo "Upload Fails";
	}
}
?>
<form action="" method="post" enctype="multipart/form-data">
	<input type="file" name="avatar">
	<input type="submit" value="Please Upload" />
</form>
